<?php
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2011, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

/**
 * The routes file is where you define your URL structure, which is an important part of the
 * [information architecture](http://en.wikipedia.org/wiki/Information_architecture) of your
 * application. Here, you can use _routes_ to match up URL pattern strings to a set of parameters,
 * usually including a controller and action to dispatch matching requests to. For more information,
 * see the `Router` and `Route` classes.
 *
 * @see lithium\net\http\Router
 * @see lithium\net\http\Route
 */
use lithium\net\http\Router;
use lithium\core\Environment;

/**
 * Real routing
 */

// home
Router::connect('/', 'Home::index');
Router::connect('/about', 'Home::about');

// trick
Router::connect('/trick/{:id:\d+}', 'Trick::index');
Router::connect('/trick/up/{:id:\d+}', 'Trick::up');
Router::connect('/trick/down/{:id:\d+}', 'Trick::down');
Router::connect('/tricks', 'Trick::all');

Router::connect('/dashboard/tricks', 'DashTrick::index');
Router::connect('/dashboard/trick/create', 'DashTrick::create');
Router::connect('/dashboard/trick/validate/{:id:\d+}', 'DashTrick::validate');
Router::connect('/dashboard/trick/edit/{:id:\d+}', 'DashTrick::edit');
Router::connect('/dashboard/trick/delete/{:id:\d+}', 'DashTrick::delete');

// comment
Router::connect('/comment/create', 'Comment::create');
Router::connect('/comment/delete/{:id:\d+}', 'Comment::delete');

// problem
Router::connect('/problem/{:id:\d+}', 'Problem::index');
Router::connect('/problem/up/{:id:\d+}', 'Problem::up');
Router::connect('/problem/down/{:id:\d+}', 'Problem::down');
Router::connect('/problems', 'Problem::all');

Router::connect('/dashboard/problems', 'DashProblem::index');
Router::connect('/dashboard/problem/create', 'DashProblem::create');
Router::connect('/dashboard/problem/validate/{:id:\d+}', 'DashProblem::validate');
Router::connect('/dashboard/problem/edit/{:id:\d+}', 'DashProblem::edit');
Router::connect('/dashboard/problem/delete/{:id:\d+}', 'DashProblem::delete');

// solution
Router::connect('/solution/create/{:idProblem:\d+}', 'Solution::create');
Router::connect('/solution/delete/{:id:\d+}', 'Solution::delete');

// user
Router::connect('/user/{:id:\d+}', 'User::index');
Router::connect('/user/login', 'User::login');
Router::connect('/user/logout', 'User::logout');
Router::connect('/user/register', 'User::register');
Router::connect('/users', 'User::all');

Router::connect('/dashboard/user/edit/{:id:\d+}', 'DashUser::edit');
Router::connect('/dashboard/user/delete/{:id:\d+}', 'DashUser::delete');



/**
 * Sketch routing
 */
Router::connect('/sketch', 'SketchFront::index');
Router::connect('/sketch/trick', 'SketchFront::trick');

Router::connect('/sketch/dashboard', 'SketchBack::index');
Router::connect('/sketch/dashboard/view', 'SketchBack::view');
Router::connect('/sketch/dashboard/form', 'SketchBack::form');



/**
 * Connect the rest of `PagesController`'s URLs. This will route URLs like `/pages/about` to
 * `PagesController`, rendering `/views/pages/about.html.php` as a static page.
 */
//Router::connect('/pages/{:args}', 'Pages::view');
//Router::connect('/hello/{:args}', 'HelloWorld::index');

/**
 * Add the testing routes. These routes are only connected in non-production environments, and allow
 * browser-based access to the test suite for running unit and integration tests for the Lithium
 * core, as well as your own application and any other loaded plugins or frameworks. Browse to
 * [http://path/to/app/test](/test) to run tests.
 */

//if (!Environment::is('production')) {
//	Router::connect('/test/{:args}', array('controller' => 'lithium\test\Controller'));
//	Router::connect('/test', array('controller' => 'lithium\test\Controller'));
//}

/**
 * ### Database object routes
 *
 * The routes below are used primarily for accessing database objects, where `{:id}` corresponds to
 * the primary key of the database object, and can be accessed in the controller as
 * `$this->request->id`.
 *
 * If you're using a relational database, such as MySQL, SQLite or Postgres, where the primary key
 * is an integer, uncomment the routes below to enable URLs like `/posts/edit/1138`,
 * `/posts/view/1138.json`, etc.
 */
// Router::connect('/{:controller}/{:action}/{:id:\d+}.{:type}', array('id' => null));
// Router::connect('/{:controller}/{:action}/{:id:\d+}');

/**
 * If you're using a document-oriented database, such as CouchDB or MongoDB, or another type of
 * database which uses 24-character hexidecimal values as primary keys, uncomment the routes below.
 */
// Router::connect('/{:controller}/{:action}/{:id:[0-9a-f]{24}}.{:type}', array('id' => null));
// Router::connect('/{:controller}/{:action}/{:id:[0-9a-f]{24}}');

/**
 * Finally, connect the default route. This route acts as a catch-all, intercepting requests in the
 * following forms:
 *
 * - `/foo/bar`: Routes to `FooController::bar()` with no parameters passed.
 * - `/foo/bar/param1/param2`: Routes to `FooController::bar('param1, 'param2')`.
 * - `/foo`: Routes to `FooController::index()`, since `'index'` is assumed to be the action if none
 *   is otherwise specified.
 *
 * In almost all cases, custom routes should be added above this one, since route-matching works in
 * a top-down fashion.
 */
Router::connect('/{:controller}/{:action}/{:args}');

?>